<?php
namespace app\admin\controller\common;

use app\admin\model\ChargingStation;
use app\admin\model\CityArea;
use app\admin\model\SystemAdmin;
use app\admin\model\SystemMenu;
use app\admin\BaseController;
use app\admin\model\SystemRole;
use think\facade\Db;
use think\facade\Log;
use think\App;
use think\facade\View;
use think\facade\Request;

class Area extends BaseController
{

    /**
     * 获取列表
     * @return $this
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getAllList(){
        $getData = Request::post();
        if($getData['parent_id']){
            $where = ['parent_id'=>$getData['parent_id']];
        }else{
            $where = ['parent_id'=>0];
        }
        $areaModel = new CityArea();
        $dataList = $areaModel->getAllList($where,'id,name');
        $backData = [
            'code'=>0,
            'data'=>$dataList,
            'msg'=>'获取成功',
        ];
        return json()->data($backData);
    }



}


